package day06_exception_collection.com.itheima.d1_exception;

import java.security.InvalidParameterException;

public class Demo4_Exception {
    public static void main(String[] args) {
        System.out.println("开始。。。");

        try {
            save(203);
            System.out.println("执行成功。。。");
        } catch (ItheimaAgeIlegalException e) {
            e.printStackTrace();
            System.out.println("程序出现异常，请稍后再试");

        }

        System.out.println("结束。。。");
    }
    public static void save(int age) throws ItheimaAgeIlegalException {
        if (age < 18 || age > 120) {
            throw new ItheimaAgeIlegalException("年龄有误");
        }
        System.out.println("保存成功！");
    }
}
